# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html

import MySQLdb
class MoviePipeline(object):
    def process_item(self, item, spider):
        conn = MySQLdb.connect(host="192.168.0.59",user="root",passwd="123123",db='scrapy',charset="utf8")
        cursor = conn.cursor()
        try:
            cursor.execute("insert into movie(movie_url) values('%s')" % (item['movie_url']) )
            conn.commit()
        except Exception as e:
            print(e)
        finally:
            conn.close()
